#! /bin/bash
cd `dirname $0`
echo "-----Start-----"

isFileExist=$(echo `find -name main.exe`)
if [[ -z $isFileExist || $2 == "restart" ]]; then
    g++ -c main.cpp lexical/lexical.cpp syntax/syntax.cpp
    g++ -o main.exe main.o lexical.o syntax.o
    rm main.o && rm lexical.o && rm syntax.o
fi

echo "-----End-----"
`./main.exe $1`